import request from '@/utils/request'

// 查询标签名，标签功能是否开启
export function sysDeptDemoList(query) {
  return request({
    url: '/label/rule/sysDeptDemoList',
    method: 'get',
    params: query
  })
}

// 新增修改标签
export function addlabel(data) {
  return request({
    url: '/label/rule/addlabel',
    method: 'post',
    data: data
  })
}
// 查询标签名
export function labelRulelist(query) {
  return request({
    url: '/label/rule/list',
    method: 'get',
    params: query
  })
}
// 查询标签名
export function selectLabelList(query) {
  return request({
    url: '/label/rule/selectLabelList',
    method: 'get',
    params: query
  })
}

// 查查询删除
export function deleteLabelRuleDetail(query) {
  return request({
    url: '/label/detail/deleteLabelRuleDetail',
    method: 'post',
    data: query
  })
}


// 新增标签规则明细
export function addDetail(data) {
  return request({
    url: '/label/detail',
    method: 'post',
    data: data
  })
}

// 查询标签名
export function detailList(query) {
  return request({
    url: '/label/detail/detailList',
    method: 'get',
    params: query
  })
}

// 查询标签里的人
export function selectCustomerLabelInfo(query) {
  return request({
    url: '/label/label/selectCustomerLabelInfo',
    method: 'get',
    params: query
  })
}

// 查询不在本标签的客户
// labelId=17
export function selectNotCustomerLabelInfo(query) {
  return request({
    url: '/label/label/selectNotCustomerLabelInfo',
    method: 'get',
    params: query
  })
}

// 查询本标签查询手机号
// labelId=17

export function selectPhoneList(query) {
  return request({
    url: '/label/label/selectPhoneList',
    method: 'get',
    params: query
  })
}

// 判断是否可以删除标签
// false 有绑定的人，不能删除。true 可以删除
// labelId=17
export function selectLabel(query) {
  return request({
    url: '/label/label/selectLabel',
    method: 'get',
    params: query
  })
}

// 标签操作
// {"labelId":17,"flag":"1","phoneList":["15165167224","13678945612"]}
export function addAndDelCustomerLabel(data) {
  return request({
    url: '/label/label/addAndDelCustomerLabel',
    method: 'post',
    data: data
  })
}

// 批量标签 查询用户
export function getLabelUser(query) {
  return request({
    url: '/label/label/selectCustomerLabelInfoList',
    method: 'get',
    params: query
  })
}

// 查询标签
export function getLabelList() {
  return request({
    url: '/label/rule/labelList',
    method: 'get',
  })
}

// 清理为无标签状态
export function delUserLabel(data) {
  return request({
    url: '/label/label/delCustomerLabel',
    method: 'post',
    data:data
  })
}

// 查询标签
export function getConsume(data) {
  return request({
    url: '/station/order/selectUserPayOrderList',
    method: 'get',
    params: data
  })
}

export function getOilNameList(data) {
  return request({
    url: '/station/price/oilNameList',
    method: 'get',
    params: data
  })
}



export function selectCustomerLabelInfoListExport(data) {
  return request({
    url: '/label/label/selectCustomerLabelInfoListExport',
    method: 'get',
    params: data
  })
}

// 修改标签
export function updateLabelRule(data) {
    return request({
      url: '/label/rule',
      method: 'put',
      data: data
    })
  }

// 查询定时修改标签信息，记录列表
export function listLabel(query) {
  return request({
    url: '/customer/label/list',
    method: 'get',
    params: query
  })
}

// 查询定时修改标签信息，记录详细
export function getLabel(timeId) {
  return request({
    url: '/customer/label/' + timeId,
    method: 'get'
  })
}

// 新增定时修改标签信息，记录
export function addLabel(data) {
  return request({
    url: '/customer/label',
    method: 'post',
    data: data
  })
}

// 修改定时修改标签信息，记录
export function updateLabel(data) {
  return request({
    url: '/customer/label',
    method: 'put',
    data: data
  })
}

// 删除定时修改标签信息，记录
export function delLabel(timeId) {
  return request({
    url: '/customer/label/' + timeId,
    method: 'delete'
  })
}

// 导出定时修改标签信息，记录
export function exportLabel(query) {
  return request({
    url: '/customer/label/export',
    method: 'get',
    params: query
  })
}
